fix: 지원 가능 대학 모집 인원 nullable 응답 처리#794
Conversation
Walkthrough
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/example/solidconnection/university/dto/UnivApplyInfoDetailResponse.java (1)
49-49: 🩺 Stability & Availability | 🟡 Minor
ApplicantsResponse내의 원시형int선언이 여전히 NPE 위험을 안고 있어요. 🧐안녕하세요!
UnivApplyInfo의studentCapacity가 Nullable(Integer) 인 점은 잘 파악하셨죠. 근데 형제 DTO 인ApplicantsResponse가 이 값을 받을 때만 또 달라졌어요. 바로 원시형int로 받고 있으라네요.이 채를 그냥 두면, DB 에서 값이 비어 올 때
Integer를int로 감쌈 (Unboxing) 하다가 '짜장면 스크래치'처럼 갑자기NullPointerException이 터져버릴 수 있어요. 따라서 같은 맥락에서Integer로 정리해 드려요.
- 현재 상태 —
ApplicantsResponse는int studentCapacity로 선언 중입니다.- 위험 요소 —
null이 넘어오면 감쌈 처리 중 예외가 발생합니다.- 제안 사항 — 필드 타입을
Integer로 변경하여 안전성을 확보합니다.public record ApplicantsResponse( String koreanName, Integer studentCapacity, String region, String country, List<ApplicantResponse> applicants) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/example/solidconnection/university/dto/UnivApplyInfoDetailResponse.java` at line 49, ApplicantsResponse still uses a primitive int for studentCapacity, which can cause NPE during unboxing when UnivApplyInfo.getStudentCapacity() is null. Update the ApplicantsResponse record to use Integer for studentCapacity and keep the mapping in UnivApplyInfoDetailResponse aligned so the value is passed through without primitive conversion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@src/main/java/com/example/solidconnection/university/dto/UnivApplyInfoDetailResponse.java`:
- Line 49: ApplicantsResponse still uses a primitive int for studentCapacity,
which can cause NPE during unboxing when UnivApplyInfo.getStudentCapacity() is
null. Update the ApplicantsResponse record to use Integer for studentCapacity
and keep the mapping in UnivApplyInfoDetailResponse aligned so the value is
passed through without primitive conversion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f1cc12a3-e6e8-42bf-8e6a-09feae15335f
📒 Files selected for processing (2)
src/main/java/com/example/solidconnection/university/dto/UnivApplyInfoDetailResponse.javasrc/main/java/com/example/solidconnection/university/dto/UnivApplyInfoPreviewResponse.java
Walkthrough
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
관련 이슈
UnivApplyInfo도메인과 admin 생성/수정 요청에서는studentCapacity가 nullable한Integer로 정의되어 있습니다.studentCapacity에nullable = false제약이 없어 DB 저장 시 null이 허용되는 구조입니다.int로 정의되어 있어, 모집 인원이 없는 데이터 조회 시 언박싱 과정에서NullPointerException이 발생했습니다.Integer로 타입을 통일하는 것이 적절하다고 판단했습니다.작업 내용
studentCapacity타입을int에서Integer로 변경했습니다.null인 지원 가능 대학 조회 시NullPointerException이 발생하던 문제를 수정했습니다.